package com.samecity.mvp.model.loginModel;

import android.content.Context;

import com.samecity.mvp.bean.RegisterLoginData;
import com.samecity.mvp.model.Http.HttpMethods;
import com.samecity.mvp.model.Http.subscribers.ProgressSubscriber;
import com.samecity.mvp.model.Http.subscribers.SubscriberOnNextListener;


/**
 * Created by Administrator on 2017/4/27 0027.
 */

public class LoginModel {

    public void userLogin(final Context context, String userName, String password, final LoginCallback callback) {
        SubscriberOnNextListener getTopMovieOnNext = new SubscriberOnNextListener<RegisterLoginData>() {
            @Override
            public void onNext(RegisterLoginData subjects) {
                if (subjects.getSta().equals("1")) {
                    callback.userLoginResult(true, subjects.getMsg());
                } else {
                    callback.userLoginResult(false, subjects.getMsg());
                }
            }
        };
        HttpMethods.getInstance().userLogin(new ProgressSubscriber(getTopMovieOnNext, context,1), "Login.login", userName, password);
    }
}
